<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setCharacterEncoding("UTF-8");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'emp_add.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css" href="css/emp_add.css">
<link href="css/sunny/jquery-ui-1.10.2.custom.css" rel="stylesheet">
<script src="js/jquery/jquery-1.9.1.js"></script>
<script src="js/jquery/jquery-ui-i18n.js"></script>
<script src="js/jquery/jquery-ui-1.10.2.custom.js"></script>
<script language="JavaScript" type="text/javascript" src="js/emp_add.js"></script>
<script>
	$(function() {
		$("#datepicker").datepicker({
			changeYear : true,
			dateFormat : 'yy-mm-dd'
		});

	});
</script>
</head>
<body>
	<h3>员工信息修改</h3>
	<c:choose>
		<c:when test="${param.update!=null}">
			<sql:update var="result1">
				update t_employee set emp_name=?,emp_sex=?,emp_borth=?,emp_edu=?,emp_bank_account=?,emp_address=?,emp_tel=? where emp_id=${sessionScope.employee.emp_id}
			    <sql:param value="${param.emp_name}" />
				<sql:param value="${param.emp_sex}" />
				<sql:param value="${param.emp_borth}" />
				<sql:param value="${param.emp_edu}" />
				<sql:param value="${param.emp_bank_account}" />
				<sql:param value="${param.emp_address}" />
				<sql:param value="${param.emp_tel}" />
			</sql:update>
			<h1>个人信息修改成功</h1>
		</c:when>
		<c:otherwise>
			<sql:query var="result"
				sql="select emp_name,emp_account,emp_sex,emp_borth,emp_edu,emp_bank_account,emp_address,emp_tel from t_employee where emp_id=${sessionScope.employee.emp_id}">
			</sql:query>
			<div id="container">
				<form id="fm-form" method="post" action="admin/emp_update_perinfo.jsp">
					<c:forEach var="row" items="${result.rows}">
						<fieldset>
							<legend>个人信息</legend>
							<div class="fm-req">
								<label for="fm-firstname">员工姓名</label> <input name="emp_name" value="${row.emp_name}"
									id="fm-firstname" type="text">
							</div>
							<div class="fm-req">
								<label for="fm-firstname">登陆账号</label> <input name="emp_account"
									id="fm-firstname" type="text" value="${row.emp_account}">
							</div>
							<div class="fm-req">
								<label for="fm-firstname">性别</label> <select id="fm-state"
									name="emp_sex">
									<option value="男" selected="selected">男</option>
									<option value="女">女</option>
								</select>
							</div>
							<div class="fm-req">
								<label for="fm-firstname">出生日期</label> <input type="text"
									id="datepicker" name="emp_birth" id="fm-firstname" type="text"
									value="${row.emp_birth} "/>
							</div>
							<div class="fm-req">
								<label for="fm-firstname">学历</label> <input
									name="emp_edu" value="${row.emp_edu}"
									id="fm-firstname" type="text">
							</div>
							<div class="fm-req">
								<label for="fm-firstname">银行账号</label> <input
									name="emp_bank_account"
									value="${row.emp_bank_account}"
									id="fm-firstname" type="text">
							</div>
						</fieldset>
						<fieldset>
							<legend>联系方式</legend>
							<div class="fm-opt">
								<label for="fm-addr">电话</label> <input id="fm-addr" name="emp_tel"
									value="${row.emp_tel}"
									type="text">
							</div>
							<div class="fm-opt">
								<label for="fm-city">住址</label>
								<textarea name="emp_address" cols="10" rows="5" id="fm-comments">${row.emp_address}</textarea>
							</div>

						</fieldset>
					</c:forEach>
					<div id="fm-submit" class="fm-req">
					<input name="update" value="update" type="hidden">
						<input name="Submit" value="&#25552; &#20132;" type="submit">
					</div>
					<br>
				</form>
			</div>

		</c:otherwise>
	</c:choose>
	<%--<h3>员工信息修改</h3>
	<div id="container">
		<form id="fm-form" method="post"
			action="employeeAction!updateEmployee.action">
			<fieldset>
				<legend>个人信息</legend>
				<div class="fm-req">
					<label for="fm-firstname">员工姓名</label> <input
						name="employee.emp_name" id="fm-firstname" type="text">
				</div>
				<div class="fm-req">
					<label for="fm-firstname">性别</label> <select id="fm-state"
						name="employee.emp_sex">
						<option value="男" selected="selected">男</option>
						<option value="女">女</option>
					</select>
				</div>
				<div class="fm-req">
					<label for="fm-firstname">出生日期</label> 
						<input type="text" id="datepicker" name="employee.emp_birth" id="fm-firstname" type="text" value='<s:property value="employee.emp_birth"/>'>
				</div>
				<div class="fm-req">
					<label for="fm-firstname">学历</label> <input name="employee.emp_edu"
						value='<s:property value="employee.emp_edu"/>' id="fm-firstname" type="text">
				</div>
				<div class="fm-req">
					<label for="fm-firstname">银行账号</label> <input name="employee.emp_bank_account"
						value='<s:property value="employee.emp_bank_account"/>' id="fm-firstname" type="text">
				</div>
			</fieldset>
			<fieldset>
				<legend>联系方式</legend>
				<div class="fm-opt">
					<label for="fm-addr">电话</label> <input id="fm-addr"
						value='<s:property value="employee.emp_tel"/>' name="employee.emp_tel" type="text">
				</div>
				<div class="fm-opt">
					<label for="fm-city">住址</label>
					<textarea name="employee.emp_address" cols="10" rows="5"
						id="fm-comments"><s:property value="employee.emp_addres" /></textarea>
				</div>

			</fieldset>

			<div id="fm-submit" class="fm-req">
				<input name="Submit" value="&#25552; &#20132;" type="submit">
			</div>
			<br>
		</form>
	</div>
--%>
</body>
</html>
